
#pragma once

#include "ITask.h"
#include "LuaEng.h"

#include "EventSystem.h"

#include <string>


//! This task is in charge of destroying one effect. It is necessary that when
//! the effect itself is destroyed, the scene manager with which the task has
//! been initialized remains valid
//!
class TaskDestroyEffect : public ITask
{

	Ogre::SceneManager * mSceneMngr;
	Ogre::SceneNode * mEffectNode;
	Ogre::ParticleSystem * mEffectSys;

public:

	//! Destroys a particle effect
	//!
	//! @param mngr Scene manager
	//! @param nodo Effect's node
	//! @param psys Particle system of the effect
	TaskDestroyEffect(Ogre::SceneManager * mngr, Ogre::SceneNode * node, Ogre::ParticleSystem * psys)
		: mSceneMngr(mngr), mEffectNode(node), mEffectSys(psys)
	{
	}

	//! Launches the event.
	//!
	virtual bool Execute()
	{
		mSceneMngr->destroySceneNode(mEffectNode);
		mSceneMngr->destroyParticleSystem(mEffectSys);
		return true;
	}

};